define(function(require, exports, module) {
	
	require("layout");
	require("form");

	var validator = require("validator");

	module.exports = function() {
		var cbox = {};
		return {
			data: {
				color:"#ffffff"
			},
			methods: {
				init:function(params) {
					var me = this;
					//添加blur校验
					validator.blur(this.$el);
					//return false时，模拟超时关闭loading，3秒后自动关闭loading
					setTimeout(function() {
						me.loading("close");
					}, 3000);
					return false;
				},
				cancel:function() {
					this.closeWindow();
				},
				submit:function() {
					this.loading();
					//validator.validate($(this.$el).find("form"))
					console.log($(this.$el).find("form").serializeArray());
					if($(this.$el).find("form").validate()) {
						console.log("提交数据");
					}
					var me = this;
					setTimeout(function() {
						me.loading("close");
					}, 2000);
				}
			}
		}
	}

});